<?php if (!defined('THINK_PATH')) exit(); /*a:2:{s:68:"/data/release/shop/public/../application/home/view/coupon/index.html";i:1511408890;s:67:"/data/release/shop/public/../application/home/view/public/base.html";i:1511407309;}*/ ?>
<!DOCTYPE html>
<html>

	<head>
		<meta charset="utf-8" />
		<link rel="stylesheet" type="text/css" href="../../static/home/css/reset.css"/>
		<link rel="stylesheet" type="text/css" href="../../static/home/css/style.css"/>
		<link rel="stylesheet" type="text/css" href="../../static/home/css/foundation-datepicker.css"/>
		<link rel="stylesheet" type="text/css" href="../../static/home/css/font-awesome.css"/>
		<script src="../../static/home/js/jquery-1.9.1.min.js" type="text/javascript" charset="utf-8"></script>
		<title></title>
	</head>


<body>
<div class="bj">
	<!--头部-->
	
	<div class="head">
		<div class="h-top">
			<ul>
				<li><a href="#"></a><span></span></li>
				<li><a href="#"></a><span></span></li>
				<li><a href="#"></a><span></span></li>
				<li><a href="#"></a></li>
			</ul>
			<div class="clear"></div>
		</div>
		<div class="h-name">
			<div class="name">
				<div class="logo left">
					<a href="#"><img src="../../static/home/img/logo.png" style="height: 40px;"/></a>
				</div>
				<div class="assistant right">
					<div class="img">
						<img src="../../static/home/img/assistant.png"/>
					</div>
					<div class="b-div">
						<img src="../../static/home/img/assistant.png"/>
						<p class="t2"><a href="../business/index">账号设置</a></p>
						<p class="t2"><a href="../index/quitLogin">退出登录</a></p>
					</div>
				</div>

			</div>
		</div>
	</div>
	
	<!--内容-->
	<div class="c">
		<div class="content">
			
			<div class="c-l left">
						<div class="c-left">
							<div class="list">
								<div class="">
									<i class="statistics"></i><span>统计分析</span>
								</div>
								<ul>
									<li><a href="../index/index">概况分析</a></li>
									<li><a href="../index/user">用户分析</a></li>

								</ul>

							</div>



							<div class="list">
								<div class="">
									<i class="imgicon"></i><span>图片管理</span>
								</div>
								<ul>
									<li><a href="../banner/index">图片管理</a></li>
								</ul>

							</div>

							<div class="list">
								<div class="">
									<i class="product"></i><span>产品管理</span>
								</div>
								<ul>
									<li><a href="../commtype/index">分类管理</a></li>
									<li><a href="../goods/index">商品管理</a></li>
									<li><a href="../integral/index">积分商品管理</a></li>
									<li><a href="../freight/index">运费模板管理</a></li>

								</ul>
							</div>

							<div class="list">
								<div class="">
									<i class="member"></i><span>会员管理</span>
								</div>
								<ul>
									<li><a href="../user/index">会员列表</a></li>
								</ul>
							</div>

							<div class="list">
								<div class="">
									<i class="order"></i><span>订单管理</span>
								</div>
								<ul>
									<li><a href="../order/index">待付款</a></li>
									<li><a href="../order/delivergoods">待发货</a></li>
									<li><a href="../order/takegoods">待收货</a></li>
									<li><a href="../order/complete">已完成</a></li>
									<li><a href="../order/occlude">已关闭</a></li>

								</ul>

							</div>

							<div class="list">
								<div class="">
									<i class="assets"></i><span>提现管理</span>
								</div>
								<ul>
									<li><a href="../takeout/index">提现审核</a></li>
									<li><a href="../takeout/record">提现记录</a></li>
								</ul>
							</div>
							<div class="list">
								<div class="">
									<i class="assets"></i><span>资产管理</span>
								</div>
								<ul>
									<li><a href="../record/index">交易记录</a></li>
								</ul>
							</div>
							<div class="list">
								<div class="">
									<i class="voucher"></i><span>优惠券</span>
								</div>
								<ul>
									<li><a href="../coupon/index">优惠券列表</a></li>


								</ul>
							</div>
							<div class="list">
								<div class="">
									<i class="hzpnews"></i><span>资讯管理</span>
								</div>
								<ul>
									<li><a href="../hzpnews/index">资讯列表</a></li>

								</ul>
							</div>

							<div class="list">
								<div class="">
									<i class="comment"></i><span>评论管理</span>
								</div>
								<ul>
									<li><a href="../comment/index">评论列表</a></li>

								</ul>
							</div>


							<div class="list">
								<div class="">
									<i class="setup"></i><span>基本设置</span>
								</div>
								<ul>
									<li><a href="">基本设置</a></li>
									<li><a href="../express/index">快递设置</a></li>

									<li><a href="../payments/index">支付设置</a></li>

									<li><a href="../business/index">商家基本信息</a></li>
									<!--<li><a href="">管理员信息</a></li>-->
								</ul>
							</div>

						</div>

					</div>

			<!--<div id="main" style="width: 600px;height:400px;"></div>-->
			
			


			
<input type="hidden" name="mun_url" id="mun_url" value="7,0"/>
<div class="c-r right">

	<div class="label1">
		<div class="title">
			优惠券分类
		</div>
		<div class="information">
			<i></i>
			<p class="h">优惠券</p>
			<p>可设置优惠券，显示用户兑换记录。</p>
			<p>优惠券三种发放方式：积分中心、优惠券码、商家后台发送，只有第一种消耗用户积分，后两者不需要。</p>
			<p>优惠券关闭以后，该批次优惠券用户端不再显示。</p>
			<p></p>
		</div>

		<!--button type="button" class="yh_btn-primary showmodel">
            <span>新增优惠券</span>
        </button-->
		<div class="">

		</div>
		<button class="yh_btn-primary showmodel mtop"><a href="add">新增优惠券</a></button>

		<div class="label-3 label">
			<div class="Tab">
				<table border="0" cellspacing="0" cellpadding="0" style="width: 984px;">
					<tr>
						<th style="width: 35px;"><input type="checkbox" name="" id="" value="" /></th>
						<th style="width: 40px;">ID</th>
						<th style="width: 75px;">剩余数量</th>
						<th style="width: 85px;">优惠券金额</th>
						<th style="width: 85px;">满多少使用</th>
						<th style="width: 140px;">菜单 / 商品</th>
						<th style="width: 90px;">类型</th>
						<th style="width: 115px;">开始时间</th>
						<th style="width: 115px;">结束时间</th>
						<th style="width: 90px;">状态</th>
						<th style="width: 150px;">操作</th>
					</tr>
				</table>
				<table border="0" cellspacing="0" cellpadding="0" style="width: 984px;">
					<?php if(is_array($list) || $list instanceof \think\Collection || $list instanceof \think\Paginator): if( count($list)==0 ) : echo "" ;else: foreach($list as $key=>$data): ?>
					<tr>
						<td style="width: 35px;"><input type="checkbox" name="" id="" value="" /></td>
						<td style="width: 40px; " class="goodsid" id="goodsid"><?php echo $data['disid']; ?></td>
						<td style="width: 75px;"><?php echo $data['number']; ?></td>
						<td style="width: 85px;"><?php echo $data['money']; ?></td>
						<td style="width: 85px;"><?php echo $data['full_money']; ?></td>
						<?php if($data['type'] == '分类'): ?>
						<td style="width: 140px;"><?php echo $data['commid']; ?></td>
						<?php elseif($data['type'] == '商品'): ?>
						<td style="width: 140px;"><?php echo $data['goodsid']; ?></td>
						<?php else: ?>
						<td style="width: 140px;"></td>
						<?php endif; ?>

						<td style="width: 90px;"><?php echo $data['type']; ?></td>
						<td style="width: 115px;"><?php echo $data['starttime']; ?></td>
						<td style="width: 115px;"><?php echo $data['endtime']; ?></td>
						<td style="width: 90px; text-align: center" class="green">
							<b><?php echo $data['types']; ?></b>
						</td>

						<?php if($data['status'] == '0'): ?>
						<td style="width: 150px;"><button class="openbtn ml bottom shelves" onclick="shelves($(this),1)">关闭</button><button class="modifybtn open-win ml" onclick="compile('edit?id=<?php echo $data['disid']; ?>')">编辑</button>
							<button class="openbtn" onclick="del('<?php echo $data['disid']; ?>','__publicPath__/home/coupon/delete')">删除</button></td>


						<?php elseif($data['status'] == '1'): ?>
						<td style="width: 150px;"><button class="modifybtn ml top" onclick="shelves($(this),0)">开启</button><button class="modifybtn open-win ml" onclick="compile('edit?id=<?php echo $data['disid']; ?>')">编辑</button>
							<button class="openbtn" onclick="del('<?php echo $data['disid']; ?>','__publicPath__/home/coupon/delete')">删除</button></td>

						<?php endif; ?>


					</tr>
					<?php endforeach; endif; else: echo "" ;endif; ?>
				</table>
			</div>
			<div style="text-align: center" class="pages">
				<?php echo $list->render(); ?>
			</div>
		</div>

	</div>
</div>

<script src="../../static/home/js/jquery-1.9.1.min.js" type="text/javascript" charset="utf-8"></script>
<script src="../../static/home/js/js.js" type="text/javascript" charset="utf-8"></script>
<script src="../../static/home/js/dateRange.js" type="text/javascript" charset="utf-8"></script>
<script src="../../static/home/js/monthPicker.js" type="text/javascript" charset="utf-8"></script>
<script type="text/javascript">
	function del(id,url){
		if(window.confirm('你确定要删除吗吗？')){
			var data = {
				id:id
			};
			$.ajax({
				type:"get",
				data: data,
				url:url,
				dataType: "json",
				success: function(data){
					if (data == 1) {
						prompt('删除成功',data)
						window.location.reload();
					} else{
						prompt('删除失败',data)
					}
				},
				error:function(){
					prompt('操作失败',0)
				}
			});
		}else{
			//alert("取消");
			return false;
		}


	}
	$("#div_date_demo3 span").css('line-height','1.5')
	var dateRange = new pickerDateRange('date_demo3', {
		aRecent7Days : 'aRecent7DaysDemo3', //最近7天
		isTodayValid : false,
		//startDate : '2013-04-14',
		//endDate : '2013-04-21',
		//needCompare : true,
		//isSingleDay : true,
		//shortOpr : true,
		defaultText : ' 至 ',
		inputTrigger : 'input_trigger_demo3',
		theme : 'ta',
		success : function(obj) {
			$("#dCon_demo3").html('开始时间 : ' + obj.startDate + '<br/>结束时间 : ' + obj.endDate);
			console.log(obj.startDate +'------' +obj.endDate)
		}
	});
	$(function () {
		var leng = $('.Tab tr')
		for (var i = 0; i < leng.length; i++){
			var txt = leng.eq(i).find('.green b').text()
			//alert(txt)
			if(txt == '已开启'){
				leng.eq(i).find('.green b').addClass('putaway')
			}
			if(txt == '已关闭'){
				leng.eq(i).find('.green b').addClass('sold ')
			}
		}

	})
	function shelves(j,v){
		var pid = j.parent().parent().find('.goodsid').text()
		var data = {
			goodsid:pid,status:v,
		};
		$.ajax({
			type:'post',
			url:"__publicPath__/home/coupon/soldOut",			//请求地址加参数
			data: data,
			success: function(data){
				window.location.reload();
				//Parent.find('.green').addClass('red')

			},
			error:function(){
				alert('更新失败')
			}
		});
	}
</script>


			<!--<div id="main" style="width: 600px;height:400px;"></div>-->
		</div>

	</div>

	<!--尾部-->
	
	<div class="foot">
		Copyright © 2016 - 2017 qingful.com All Rights Reserved
	</div>
	
	<!--返回顶部-->


</div>
<script src="../../static/home/js/dateRange.js" type="text/javascript" charset="utf-8"></script>
<script src="../../static/home/js/js.js" type="text/javascript" charset="utf-8"></script>
<script>
	//索引0开始
	var mun_url = $('#mun_url').val();											//获取页面参数
	var arrmun_url = mun_url.split(",")											//转成数组格式
	var leftul = $(".c .c-l .list ul").eq(arrmun_url[0]).find('li').length		//获取元素数量
	$(".c .c-l .list ul").eq(arrmun_url[0]).css('height',50*leftul)				//设置高度
	$(".c .c-l .list ul").eq(arrmun_url[0]).find('li').eq(arrmun_url[1]).attr('class','act')	//添加样式
</script>
</body>

</html>








